#library

## Warning in as.POSIXlt.POSIXct(Sys.time()): unable to identify current timezone 'C':
## please set environment variable 'TZ'
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.2 ──
## ✔ ggplot2 3.3.6      ✔ dplyr   1.0.10
## ✔ tibble  3.1.8      ✔ stringr 1.4.1 
## ✔ tidyr   1.2.1      ✔ forcats 0.5.2 
## ✔ purrr   0.3.4      
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## Warning: package 'vroom' was built under R version 4.2.2
## Warning: package 'gganimate' was built under R version 4.2.2
## Warning: package 'maps' was built under R version 4.2.2
## 
## Attaching package: 'maps'
## 
## The following object is masked from 'package:purrr':
## 
##     map
## Warning: package 'cowplot' was built under R version 4.2.2
## Warning: package 'tinytex' was built under R version 4.2.2

#Link to Download the dataset https://platform.who.int/mortality/countries/country-details/MDB/luxembourg #Link to Download the dataset world https://platform.who.int/mortality/themes/theme-details/MDB/noncommunicable-diseases #https://ourworldindata.org/age-structure #Read the dataset and Tidy.

## Rows: 397429 Columns: 10
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (5): Indicator_Code, Indicator_Name, Sex, Age_group_code, Age_Group
## dbl (5): Year, Number, Percentage_of_cause_specific_deaths_out_of_total_deat...
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
## New names:
## Rows: 53 Columns: 12
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (7): Region_Code, Region_Name, Country_Code, region, Sex, Age_group_code...
## dbl (5): Year, Number, Percentage_of_cause_specific_deaths_out_of_total_deat...
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
## New names:
## Rows: 291 Columns: 13
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (7): Region_Code, Region_Name, Country_Code, region, Sex, Age_group_code...
## dbl (4): Year, Number, Percentage_of_cause_specific_deaths_out_of_total_deat...
## lgl (2): Age_standardized_death_rate_per_100_000_standard_population, ...13
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
## New names:
## Rows: 18138 Columns: 4
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (2): region, Code
## dbl (2): Year, estimates_age
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.

We want to see how the death rate varies over the years 1960 to 2021. We specifically select deaths for all age groups. During our analysis, we will notice the difference by gender.

## geom_path: Each group consists of only one observation. Do you need to adjust
## the group aesthetic?
## geom_path: Each group consists of only one observation. Do you need to adjust
## the group aesthetic?

We notice that in Luxembourg, the mortality rate.then it decreased until 2020. then this rate decreased in a decreasing way until 2020.This makes sense because in Luxembourg there have been several epidemics that could affect lives. The mortality rate has decreased significantly thanks to more modern methods of care.

We shall now analyze some major causes of mortality in luxembourg and how these causes have affected different age groups.

## # A tibble: 193 × 2
##    Indicator_Name                            n
##    <chr>                                 <int>
##  1 All Causes                             2703
##  2 Appendicitis                           2703
##  3 Birth asphyxia and birth trauma        2703
##  4 Breast cancer                          2703
##  5 Cardiovascular diseases                2703
##  6 Cataracts                              2703
##  7 Cerebrovascular disease                2703
##  8 Childhood-cluster diseases             2703
##  9 Chronic obstructive pulmonary disease  2703
## 10 Cirrhosis of the liver                 2703
## # … with 183 more rows

#Number of deaf by noncommunicatif desease by cat age

#Find the Year , where we have most mortality from Age 54 to 74 in luxembourg

#Comparing the mortality cause by noncomminicate desase in Luxembourg to other country from 54 to 74

#Life experience in 2000 comparing the rest of the word in 2000(Map) with noncommunication desases

## # A tibble: 18,138 × 4
##    region      Code   Year estimates_age
##    <chr>       <chr> <dbl>         <dbl>
##  1 Afghanistan AFG    1956          78.9
##  2 Afghanistan AFG    1957          79.2
##  3 Afghanistan AFG    1958          79.6
##  4 Afghanistan AFG    1959          79.8
##  5 Afghanistan AFG    1960          80.0
##  6 Afghanistan AFG    1961          80.2
##  7 Afghanistan AFG    1962          80.4
##  8 Afghanistan AFG    1963          80.7
##  9 Afghanistan AFG    1964          81.2
## 10 Afghanistan AFG    1965          82  
## # … with 18,128 more rows

#study cas of the mortality by noncommunicate deseas(Regression linear)

#Prediction for 2023